import request from '../../request'
interface Form {
    djsj: string
    jsbh: string
    jsmc: string
    px: number
    xxzjbh: string
}

export default {
    queryRole() {
        return request({ //查询角色信息
            url: '/jsxx/pagingQuerySet',
            method: 'post'
        })
    },
    delData(xxzjbhs: string) {
        return request({//删除或批量删除根据主键
            url: "/jsxx/deleteData",
            method: 'post',
            params: {
                xxzjbhs: xxzjbhs
            }
        })
    },
    addData(form: Form) {
        return request({//角色新增
            url: "/jsxx/insertData",
            method: 'post',
            data: form
        })
    },
    updateRole(form: Form, xxzjbh: string) {

        return request({ //角色更新
            url: '/jsxx/updateData',
            method: 'post',
            data: {
                djsj: form.djsj,
                jsbh: form.jsbh,
                jsmc: form.jsmc,
                px: form.px,
                xxzjbh: xxzjbh
            }
        })
    },

    insertData(form: Form, roleList: [{ jsbh: string, jsmc: string, xtbh: string, xtmc: string }]) {
        return request({ //角色更新
            url: '/jscdGlxx/insertData',
            method: 'post',
            data: {
                cdxxList: form,
                jsbh: roleList[0].jsbh,
                jsmc: roleList[0].jsmc,
                xtbh: roleList[0].xtbh,
                xtmc: roleList[0].xtmc
            }
        })
    },
    menuRole(jsbh: string, xtbh: string) {
        return request({//角色新增
            url: "/cdxx/getCdxxTreeByJs",
            method: 'post',
            data: {
                jsbh: jsbh,
                xtbh: xtbh
            }
        })
    },
    roleNumberRule(jsbh: string) {
        return request({//角色编号是否重复校验规则
            url: "/jsxx/checkJsbh",
            method: 'post',
            params: {
                jsbh: jsbh
            }
        })
    }
}